package br.urca.model;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 * @author Lucas
 */
@Embeddable
public class BiCopiasEmprestadasPK implements Serializable {
   
	private static final long serialVersionUID = 1L;
	
	@Basic(optional = false)
    @Column(name = "COD_TIPO_MATERIAL")
    private Character codTipoMaterial;
	
    @Basic(optional = false)
    @Column(name = "COD_NUMERO_MATERIAL")
    private int codNumeroMaterial;
    
    @Basic(optional = false)
    @Column(name = "COD_REGISTRO")
    private String codRegistro;

    public BiCopiasEmprestadasPK() {
    }

    public BiCopiasEmprestadasPK(Character codTipoMaterial, int codNumeroMaterial, String codRegistro) {
        this.codTipoMaterial = codTipoMaterial;
        this.codNumeroMaterial = codNumeroMaterial;
        this.codRegistro = codRegistro;
    }

    public Character getCodTipoMaterial() {
        return codTipoMaterial;
    }

    public void setCodTipoMaterial(Character codTipoMaterial) {
        this.codTipoMaterial = codTipoMaterial;
    }

    public int getCodNumeroMaterial() {
        return codNumeroMaterial;
    }

    public void setCodNumeroMaterial(int codNumeroMaterial) {
        this.codNumeroMaterial = codNumeroMaterial;
    }

    public String getCodRegistro() {
        return codRegistro;
    }

    public void setCodRegistro(String codRegistro) {
        this.codRegistro = codRegistro;
    }

    @Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + codNumeroMaterial;
		result = prime * result
				+ ((codRegistro == null) ? 0 : codRegistro.hashCode());
		result = prime * result
				+ ((codTipoMaterial == null) ? 0 : codTipoMaterial.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		BiCopiasEmprestadasPK other = (BiCopiasEmprestadasPK) obj;
		if (codNumeroMaterial != other.codNumeroMaterial)
			return false;
		if (codRegistro == null) {
			if (other.codRegistro != null)
				return false;
		} else if (!codRegistro.equals(other.codRegistro))
			return false;
		if (codTipoMaterial == null) {
			if (other.codTipoMaterial != null)
				return false;
		} else if (!codTipoMaterial.equals(other.codTipoMaterial))
			return false;
		return true;
	}

	@Override
    public String toString() {
        return "model.BiCopiasEmprestadasPK[ codTipoMaterial=" + codTipoMaterial + ", codNumeroMaterial=" + codNumeroMaterial + ", codRegistro=" + codRegistro + " ]";
    }
    
}
